# -*- coding: utf-8 -*-
"""
 @Time    : 2021/2/25 下午4:32
 @Author  : tgy
 
"""


def add_wrapper(**kwargs):
    def add_attr(cls):
        ...
        for k, v in kwargs.items():
            setattr(cls, k, v)
        return cls

    return add_attr


def eat(self):
    print('eat')


class TopExtra(type):

    def __call__(self, classname,superclasses,attributedict):
        ...
        print('-------')
        print(self)
        print('-------')
        obj = self.__new__(self, classname, superclasses, attributedict)
        self.__init__(obj,classname, superclasses, attributedict)
        return obj

# Extra = TopExtra('Extra',(),{})
class Extra(type, metaclass=TopExtra):

    def __init__(self, classname, superclasses, attributedict):
        ...
        print(attributedict)

    def __new__(cls, classname, superclasses, attributedict):
        ...
        attributedict['eat'] = eat
        return super().__new__(cls, classname, superclasses, attributedict)

# Person = Extra(classname,superclasses,attributedict)
# @add_wrapper(eat=eat)
class Person(metaclass=Extra):
    ...

    def __call__(self, *args, **kwargs):
        ...
        print(self)

if __name__ == '__main__':
    ...
    person = Person()
    person()

